package com.qc31.monitorlib.ui.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter

/** @author joker @date 2022/9/2$ 17:11$ */
class MViewPagerAdapter(private val fragments: ArrayList<Fragment>, manager: FragmentManager) :
    FragmentStatePagerAdapter(manager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
    private var tabTitles = ArrayList<String>()
    override fun getCount(): Int {
        return fragments.size
    }


    override fun getPageTitle(position: Int): CharSequence {
        return tabTitles[position]
    }

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    fun setPageTitle(tabTitles: ArrayList<String>) {
        this.tabTitles = tabTitles

    }
}